package com.chenfan.mcn.controller;


import com.chenfan.mcn.annotations.ActionTracing;
import com.chenfan.mcn.exception.McnErrorCode;
import com.chenfan.mcn.extension.Res;
import com.chenfan.mcn.service.StarContractService;
import com.chenfan.mcn.utils.BusinessAssert;
import com.chenfan.privilege.common.config.UrlAuth;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 红人签约合同
 * @author wulg
 * @since 2021-07-20
 */
@Slf4j
@RestController
@RequestMapping("/starContract")
public class StarContractController {

    @Autowired
    private StarContractService starContractService;

    /**
     * 红人签约合同解约
     * @param id
     * @return
     */
    @ActionTracing("解约")
    @PostMapping("/termination")
    @UrlAuth({"basisFilesList_rescind"})
    public Res<Boolean> termination(@RequestParam Long id) {
        BusinessAssert.notNull(id, McnErrorCode.PARAM_ERROR,"红人签约合同ID不能为空");
        return Res.ok(starContractService.termination(id));
    }
}
